<script>
import axios from "axios";
import {ElMessageBox} from "element-plus";

export default {
  name: "ReadCard",
  data(){
    return {
      fineCardArr:{},
      newFineCardArr:{}
    }
  },
  methods:{
    audit(item){
      console.log(item);
      ElMessageBox({
        message:"是否让该资源通过？",
        confirmButtonText:"通过",
        cancelButtonText:"不通过",
        showCancelButton: true,
      }).then(() => {
        console.log("通过了");
        axios.post("http://113.44.66.99:8080/auditPass",item,).then(res=>{
          window.location.reload();
        })
      })
    }
  },
  mounted() {
    axios.post("http://113.44.66.99:8080/getAllCard").then((response) => {
      this.fineCardArr = response.data.data;
      this.newFineCardArr = this.fineCardArr.filter((item)=>{
        return item.isAudit==false;
      })
    })
  }
}
</script>

<template>
  <el-card style="max-width:100%;" class="m-0 h-full">
    <template #header>
      <div class="card-header">
        <span>未审核资源列表</span>
      </div>
    </template>

    <div v-for="(item,index) in newFineCardArr" :key="index" class="bg-gray-600/50 h-32 mb-5 flex rounded-2xl">
      <div class=" w-10/12 flex items-center "><img :src="item.head_pic" class="rounded-full w-20 h-20">
        <div class="text-2xl text-gray-700  flex">
          {{item.userNickName}}
          <div class="text-black">发布</div>
          <div class="truncate ...  w-56 ">{{item.contextTitle}}</div>
        </div>

      </div>
      <div class=" flex justify-center items-center w-1/12 ">
        <div class="border bg-green-400/30 hover:brightness-150 w-20 h-20 flex items-center justify-center text-3xl rounded-full" @click="audit(item)">审核</div>
      </div>
      <div class="grow flex justify-center items-center">
        <a :href="'/cardMessage.html?CardId='+item.contentCardId">
          <svg  t="1734531859487" class="icon hover:cursor-pointer hover:brightness-50" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4270" width="128" height="128"><path d="M444.081633 689.632653c-5.22449 0-10.44898-2.089796-14.628572-6.269388-8.359184-8.359184-8.359184-21.420408 0-29.779592l156.734694-156.734693c8.359184-8.359184 21.420408-8.359184 29.779592 0 8.359184 8.359184 8.359184 21.420408 0 29.779591l-156.734694 156.734694c-4.702041 4.179592-9.926531 6.269388-15.15102 6.269388z" fill="#333333" p-id="4271"></path><path d="M600.816327 532.897959c-5.22449 0-10.44898-2.089796-14.628572-6.269388l-156.734694-156.734693c-8.359184-8.359184-8.359184-21.420408 0-29.779592 8.359184-8.359184 21.420408-8.359184 29.779592 0l156.734694 156.734694c8.359184 8.359184 8.359184 21.420408 0 29.779591-4.702041 4.179592-9.926531 6.269388-15.15102 6.269388z" fill="#333333" p-id="4272"></path><path d="M512 929.959184c-230.4 0-417.959184-187.559184-417.959184-417.959184s187.559184-417.959184 417.959184-417.959184 417.959184 187.559184 417.959184 417.959184-187.559184 417.959184-417.959184 417.959184z m0-794.122449c-207.412245 0-376.163265 168.75102-376.163265 376.163265s168.75102 376.163265 376.163265 376.163265 376.163265-168.75102 376.163265-376.163265-168.75102-376.163265-376.163265-376.163265z" fill="#333333" p-id="4273"></path></svg>
        </a>
      </div>
    </div>
  </el-card>
</template>

<style scoped>

</style>